home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11534 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  883 b 

  1. From: _GOYRA_@msn.com (David Byrden)
  2. Subject: RE: Explicit copy constructor calls illegal?
  3. Date: 15 Mar 96 04:30:55 -0800
  4. References: <4i9tp8$fgt@reznor.larc.nasa.gov>
  5. Message-ID: <00001a81+0000ad4e@msn.com>
  6. Path: news.msn.com!msn.com
  7. Newsgroups: comp.lang.c++
  8. Organization: The Microsoft Network (msn.com)
  9.  
  10.  
  11. >> When I try to do this (just trying to re-use code - it is there, why not?),
  12. >> a new instance of the class is instantiated SOMEWHERE
  13.  
  14.     Well, you didn't post your code, but be advised that explicit ctor 
  15. calls are not possible, no matter how much you would like to reuse 
  16. the code. All ctor calls are associated with the creation of a fresh 
  17. object. When you call the copy ctor, I guess you create a temporary 
  18. object, whose lifetime does not extend beyond its own statement. 
  19. Hence you should see the copy ctor and the dtor called for this 
  20. temporary object.
  21.  
  22.                     David
  23.